<?xml version="1.0" encoding="UTF-8"?>
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
        xmlns:p="http://primefaces.org/ui">
    <h:form>
        <p:remoteCommand name="adicionarProfessor" action="#{docenteCtrl.adicionarNovoProfessor()}" oncomplete="dlgEdicaoDocente.show();" update=":frmEdicaoDocente" />
        <p:remoteCommand name="adicionarFuncionario" action="#{docenteCtrl.adicionarNovoFuncionario()}" oncomplete="dlgEdicaoDocente.show();" update=":frmEdicaoDocente" />
        <p:remoteCommand name="editarDocente" action="#{docenteCtrl.editarDocente()}" oncomplete="dlgEdicaoDocente.show();" update=":frmEdicaoDocente" />
    </h:form>
    
    <p:dialog widgetVar="dlgEdicaoDocente" closable="false" modal="true" header="Dados do Docente" resizable="false" dynamic="true">
        <h:form id="frmEdicaoDocente">
            <p:panelGrid columns="2" rendered="#{docenteCtrl.docente != null}">
                <h:outputLabel value="Nome:" />
                <p:inputText value="#{docenteCtrl.docente.nome}" required="true" />
                
                <h:outputLabel value="Nome Completo:" />
                <p:inputText value="#{docenteCtrl.docente.nomeCompleto}" required="true" />
                
                <h:outputLabel value="Email:" />
                <p:inputText value="#{docenteCtrl.docente.email}" />
            </p:panelGrid>
            
            <p:commandButton action="#{docenteCtrl.salvarDocente()}" value="Salvar" update=":form-principal :form-sidebar" icon="ui-icon-disk" oncomplete="dlgEdicaoDocente.hide();" />
            <p:commandButton action="#{docenteCtrl.cancelarEdicao()}" immediate="true" value="Cancelar" update=":form-principal :form-sidebar" icon="ui-icon-close" oncomplete="dlgEdicaoDocente.hide();" />
        </h:form>
    </p:dialog>
</ui:composition>